#!/bin/bash

# Database deployment script
set -e

echo "Starting deployment of domestic database test environment..."

# Create data directories
echo "Creating data directories..."
sudo mkdir -p /home/data/database/{opengauss,oceanbase,tdengine,matrixone,milvus}
sudo chmod -R 755 /home/data/database

# Change to docker-compose directory
cd "$(dirname "$0")/../docker-compose"

# Start all services
echo "Starting database services..."
docker-compose up -d

# Wait for services to start
echo "Waiting for services to start..."
sleep 30

# Check service status
echo "Checking service status..."
docker-compose ps

echo "Database deployment completed!"
echo "Access Information:"
echo "openGauss: 127.0.0.1:5432"
echo "OceanBase: 127.0.0.1:2881" 
echo "TDengine: 127.0.0.1:6030"
echo "MatrixOne: 127.0.0.1:6001"
echo "Milvus: 127.0.0.1:19530"